//
//  receiveTypeController.m
//  QuickCure1
//
//  Created by 冬冬 on 2016/11/2.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "receiveTypeController.h"

@interface receiveTypeController ()<UITableViewDelegate,UITableViewDataSource>

@end

static NSString *cellId = @"cellId";
@implementation receiveTypeController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"治疗方式";
    
    //创建一个tableView
    UITableView *tableView = [[UITableView alloc]initWithFrame:self.view.bounds style:UITableViewStylePlain];
    [self.view addSubview:tableView];
    tableView.rowHeight = 40;
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    //注册
    [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellId];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
    NSArray *arr = @[@"手术治疗",@"药物治疗",@"保守治疗"];
    cell.textLabel.text = arr[indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
//    NSLog(@"%@",cell.textLabel.text);
    [[NSNotificationCenter defaultCenter] postNotificationName:@"receiveType" object:cell userInfo:nil];
    
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)dealloc{
    [[NSNotificationCenter defaultCenter]removeObserver:self];
    NSLog(@"receiveTypeController释放");
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
